//import com.alibaba.fastjson.JSONObject;
//import com.alibaba.ververica.cdc.connectors.mysql.MySQLSource;
//import com.alibaba.ververica.cdc.connectors.mysql.table.StartupOptions;
//import com.alibaba.ververica.cdc.debezium.DebeziumDeserializationSchema;
//import com.alibaba.ververica.cdc.debezium.DebeziumSourceFunction;
//import com.ververica.cdc.connectors.mysql.table.StartupOptions;
//import io.debezium.data.Envelope;
//import org.apache.flink.api.common.restartstrategy.RestartStrategies;
//import org.apache.flink.api.common.typeinfo.TypeInformation;
//import org.apache.flink.runtime.state.filesystem.FsStateBackend;
//import org.apache.flink.streaming.api.CheckpointingMode;
//import org.apache.flink.streaming.api.datastream.DataStreamSource;
//import org.apache.flink.streaming.api.environment.CheckpointConfig;
//import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
//import org.apache.flink.util.Collector;
//import org.apache.kafka.connect.data.Field;
//import org.apache.kafka.connect.data.Struct;
//import org.apache.kafka.connect.source.SourceRecord;
//
//import java.util.Properties;
//
//public class Flink_CDCWithCustomerSchema {
//
//    public static void main(String[] args) throws Exception {
//
//        //1.创建执行环境
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        env.setParallelism(1);
//
//        //2.创建Flink-MySQL-CDC的Source
//        Properties properties = new Properties();
//
//        //initial (default): Performs an initial snapshot on the monitored database tables upon first startup, and continue to read the latest binlog.
//        //latest-offset: Never to perform snapshot on the monitored database tables upon first startup, just read from the end of the binlog which means only have the changes since the connector was started.
//        //timestamp: Never to perform snapshot on the monitored database tables upon first startup, and directly read binlog from the specified timestamp. The consumer will traverse the binlog from the beginning and ignore change events whose timestamp is smaller than the specified timestamp.
//        //specific-offset: Never to perform snapshot on the monitored database tables upon first startup, and directly read binlog from the specified offset.
//        DebeziumSourceFunction<String> mysqlSource = MySQLSource.<String>builder()
//                .hostname("hadoop101")
//                .port(3306)
//                .username("root")
//                .password("000000")
//                .databaseList("gmall2021")
//                .tableList("gmall2021.user_info")         //可选配置项,如果不指定该参数,则会读取上一个配置下的所有表的数据,注意：指定的时候需要使用"db.table"的方式
//                .debeziumProperties(properties)
//                .startupOptions(StartupOptions.initial())
//                .deserializer(new CustomerDeserialization())
//                .build();
//
//        //3.使用CDC Source从MySQL读取数据
//        DataStreamSource<String> mysqlDS = env.addSource(mysqlSource);
//
//        //4.打印数据
//        mysqlDS.print();
//
//        //5.执行任务
//        env.execute();
//    }
//}